<template>
  <el-dialog
    v-el-drag-dialog
    title="订单图片"
    :visible.sync="visible"
    width="800px"
  >
    <el-timeline :reverse="false">
      <el-timeline-item
        v-for="(activity, index) in activities"
        :key="index"
        :timestamp="activity.timestamp"
      >
        {{ activity.content }}
      </el-timeline-item>
    </el-timeline>
  </el-dialog>
</template>

<script>
  import { queryOrderImages } from '@/api'

  export default {
    name: 'OrderImages',
    data() {
      return {
        visible: false,
        orderCode: '',
        imagesData: {},
        imageViewPath: 'http://image.haoyunqi.com.cn/',
        activities: [{
          content: '活动按期开始',
          timestamp: '2018-04-15'
        }, {
          content: '通过审核',
          timestamp: '2018-04-13'
        }, {
          content: '创建成功',
          timestamp: '2018-04-11'
        }]
      }
    },
    methods: {
      async open(temp) {
        if (temp) {
          this.orderCode = temp.orderCode
          const res = await queryOrderImages({ orderCode: temp.orderCode })
          this.activities = res.data
        }
        return new Promise(resolve => {
          this.resolve = resolve
          this.visible = true
        })
      }
    }
  }
</script>

<style scoped>

</style>
